<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var allNum = prompt('请输入班级总人数');
        var sum=0;
        for (var i = 1; i <= allNum;i++) {
            var num = prompt('请输入第' + i + '个同学成绩');
            console.log(num);
            sum +=parseInt (num);
           console.log(sum);
        }
        alert('学生总成绩是'+sum);
        alert('学生的平均成绩是'+sum/(i-1))

    </script>
</head>

<body>

</body>

</html>